Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-table3

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-table3

Pretty unicode tables for the command line. Based on the original cli-table.

  • 0.6.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2M
decreased by-57.64%
Maintainers
2
Weekly downloads
 
Created

What is cli-table3?

The cli-table3 npm package is a utility for rendering Unicode-aided tables on the command line from your node.js scripts. It is a fork of the original cli-table package and provides additional features and bug fixes. It allows for easy table creation with customizable characters for the border and columns, as well as alignment and color options for the text within the cells.

What are cli-table3's main functionalities?

Basic Table Creation

This feature allows you to create a simple table with rows and columns. The code sample demonstrates how to instantiate a new table, add rows to it, and then print it to the console.

const Table = require('cli-table3');
const table = new Table();
table.push(
  ['First column', 'Second column'],
  ['First row', 'Second row']
);
console.log(table.toString());

Custom Table Styling

This feature allows for customization of the table's appearance. The code sample shows how to create a table with custom border characters and styles.

const Table = require('cli-table3');
const table = new Table({
  style: { head: [], border: [] },
  chars: {
    'top': '═', 'top-mid': '╤', 'top-left': '╔', 'top-right': '╗',
    'bottom': '═', 'bottom-mid': '╧', 'bottom-left': '╚', 'bottom-right': '╝',
    'left': '║', 'left-mid': '╟', 'mid': '─', 'mid-mid': '┼',
    'right': '║', 'right-mid': '╢', 'middle': '│'
  }
});
table.push(
  ['First column', 'Second column'],
  ['First row', 'Second row']
);
console.log(table.toString());

Column Width and Alignment

This feature allows you to specify the width and alignment of columns. The code sample demonstrates setting the width of each column and aligning the text within them.

const Table = require('cli-table3');
const table = new Table({
  colWidths: [20, 30],
  colAligns: ['left', 'right'],
});
table.push(
  ['Left aligned', 'Right aligned'],
  ['Longer text in the first column', 'Text in the second column']
);
console.log(table.toString());

Other packages similar to cli-table3

Keywords

FAQs

Package last updated on 12 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc